import React, { Component } from 'react'
import { Link } from 'react-router-dom'

class Login extends Component {
    constructor(props) {
        super(props)
    }
    render() {
        return (
            <div className='login_container'>
                <header>
                    <img src='https://account.xiaomi.com/static/res/7f6f2f5/account-static/respassport/acc-2014/img/mistore_logo.png' />
                </header>
                <main>
                    <div>
                        <div className='login_item'>
                            <div>
                                <span>账号登录</span>
                                <i>|</i>
                                <span>扫码登录</span>
                            </div>
                            <div>
                                <input ref='name' placeholder='邮箱/手机号码/小米ID' />
                                <input ref='pass' type='password' placeholder='密码' />
                                <div onClick={() => {
                                    var name = this.refs.name.value;
                                    var pass = this.refs.pass.value;
                                    if (name.length == 0 || pass.length == 0) {
                                        alert('输入内容不能为空');
                                        return
                                    }
                                    this.props.history.push({
                                        pathname: '/',
                                        state: {
                                            name: name,
                                            pass: pass,
                                        }
                                    })
                                    localStorage.setItem('login', name);
                                }}>
                                    登录
                                </div>
                            </div>
                            <div>
                                <p><span>手机短信登录/注册</span></p>
                                <p><span>立即注册 | 忘记密码?</span></p>
                            </div>
                            <img src='3.png' />
                        </div>
                    </div>
                </main>
            </div>
        )
    }
    componentDidMount() {

    }
}

export default Login;